package com.xingzhe.pengji.security.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.xingzhe.pengji.security.domain.User;
import com.xingzhe.pengji.security.mapper.provider.UserSqlProvider;

/**
 * @Title ： 三江学院 毕业设计
 * @Description ：
 * @author ：LuFengLiang
 * @Company: IT行者工作室
 * @Copyright: Copyright (c) 2012-2-24
 * @version ： 1.0
 * @param <T>
 */
public interface UserMapper<T extends User> extends SqlMapper<T>
{

    final String USER_RESULT_MAP = "com.xingzhe.pengji.security.domain.User.userResultMap";

    @ResultMap(USER_RESULT_MAP)
    @SelectProvider(type = UserSqlProvider.class, method = "queryForPaginatedList")
    public List<T> queryForPaginatedList(Map<String, Object> map);

    @SelectProvider(type = UserSqlProvider.class, method = "getItemCount")
    public int getItemCount(Map<String, Object> map);

    @Insert("insert into sao_users(account,name,password,email,creator,create_time,update_man,update_time)values(#{account},#{name},#{password},#{email},#{creator},#{createTime},#{updateMan},#{updateTime})")
    public void saveUser(T entity);

    @UpdateProvider(type = UserSqlProvider.class, method = "updateUser")
    public void updateUser(T entity);

    @ResultMap(USER_RESULT_MAP)
    @SelectProvider(type = UserSqlProvider.class, method = "getUser")
    public List<T> getUsers(Map<String, Object> map);

    @SelectProvider(type = UserSqlProvider.class, method = "getAllAuthoritiesByUserAccount")
	public List<String> getAllAuthoritiesByUserAccount(String userAccount);

}
